/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package org.tnmk.worktime.service.model.xmladapter;

import javax.xml.bind.annotation.adapters.XmlAdapter;
import org.joda.time.DateTime;
import org.tnmk.worktime.utils.TimeUtils;

/**
 *
 * @author tnmkhoi
 */
public class DateTimeXmlAdapter extends XmlAdapter<String, DateTime>{

  @Override
  public DateTime unmarshal(String v) throws Exception {
    return TimeUtils.toDateTime(v);
  }

  @Override
  public String marshal(DateTime v) throws Exception {
    return TimeUtils.toString(v);
  }
  
}
